home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / net / ds5000.md / netLEMachInt.h < prev    next >
C/C++ Source or Header  |  1991-03-19  |  2KB  |  74 lines

  1. /*
  2.  * netLEMachInt.h --
  3.  *
  4.  *    Internal definitions for the ds5000-based LANCE controller.
  5.  *
  6.  * Copyright 1990 Regents of the University of California
  7.  * Permission to use, copy, modify, and distribute this
  8.  * software and its documentation for any purpose and without
  9.  * fee is hereby granted, provided that the above copyright
  10.  * notice appear in all copies.  The University of California
  11.  * makes no representations about the suitability of this
  12.  * software for any purpose.  It is provided "as is" without
  13.  * express or implied warranty.
  14.  */
  15.  
  16. #ifndef _NETLEMACHINT
  17. #define _NETLEMACHINT
  18.  
  19. #include <netInt.h>
  20. #include <machAddrs.h>
  21.  
  22. /*
  23.  * Register address port and register data port definition.
  24.  */
  25.  
  26. typedef struct NetLEMach_Reg {
  27.     volatile unsigned short    dataPort;    /* RDP */
  28.     unsigned short unused;
  29.         volatile unsigned short    addrPort[1];    /* RAP */
  30. } NetLEMach_Reg;
  31.  
  32. #define NET_LE_REG_SIZE    6
  33.  
  34. /*
  35.  * Defined constants:
  36.  */
  37.  
  38. /*
  39.  * We have to copy the packets into the network buffer.
  40.  */
  41.  
  42. #define NET_LE_COPY_PACKET        TRUE
  43.  
  44. /*
  45.  * Misc addresses (offsets from slot address).
  46.  */
  47.  
  48. #define NET_LE_MACH_BUFFER_OFFSET    0x0
  49. #define NET_LE_MACH_BUFFER_SIZE        0x20000
  50. #define NET_LE_MACH_RDP_OFFSET        0x100000
  51. #define NET_LE_MACH_RAP_OFFSET        0x100004
  52. #define NET_LE_MACH_DIAG_ROM_OFFSET    0x1c0000
  53. #define NET_LE_MACH_ESAR_OFFSET        0x1c0000
  54.  
  55. /*
  56.  * Macros for converting chip to cpu and cpu to chip address.
  57.  * We always deal with chip addresses in two parts, the lower 16 bits
  58.  * and the upper 8 bits.
  59.  */
  60. #define    NET_LE_FROM_CHIP_ADDR(statePtr, high,low)    \
  61.         ((Address) (statePtr->bufAddr + ((high) << 16) + (low)))
  62. #define    NET_LE_TO_CHIP_ADDR_LOW(a) ( ((unsigned int) (a)) & 0xffff)
  63.  
  64. #define    NET_LE_TO_CHIP_ADDR_HIGH(a) ( (((unsigned int) (a)) >> 16) & 0x1)
  65.  
  66. /*
  67.  * Macro to allocate a network buffer.  For the ds5000 we call the 
  68.  * routine to allocate memory in the region accessible by the chip.
  69.  */
  70. #define BufAlloc(statePtr, numBytes) \
  71.     NetLEMemAlloc((statePtr), (numBytes))
  72.  
  73. #endif /* _NETLEMACHINT */
  74.